package com.pokeoffice.commands;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

import com.pokeoffice.interfaces.Command;

/**
 * The Class TestCommand.
 */
public class TestCommand implements Command {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = -5079930872025481579L;
	
	/** The value. */
	private int value = 0;

	/** The filename. */
	private String filename;
	
	/**
	 * Instantiates a new test command.
	 *
	 * @param value the value
	 * @param filename the filename
	 */
	public TestCommand(int value, String filename) {
		this.value = value;
		this.filename = filename;
	}
	
	/* (non-Javadoc)
	 * @see com.pokeoffice.interfaces.Command#execute()
	 */
	public void execute() {
		BufferedWriter out = null;
		
		try {
			out = new BufferedWriter(new FileWriter(new File(filename), true));
			out.write(value + "\n");
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
